<template>
  <div>
    <mt-header title="维修接单">
      <mt-button slot="left" icon="back" @click="goback()"></mt-button>
      <mt-button slot="right" @click="updateBillInfo()">提交</mt-button>
    </mt-header>
    <div>
      <span class="left">工单编号：</span>
      <span class="right" v-bind="fgdno">{{fgdno}}</span>
    </div>
    <div>
      <span class="left">设备：</span>
      <span class="right" v-bind="fsbname">{{fsbname}}</span>
    </div>
    <div>
      <span class="left">机构：</span>
      <span class="right" v-bind="fsbjgname">{{fsbjgname}}</span>
    </div>
    <div>
      <span class="left">子机构：</span>
      <span class="right" v-bind="fsbzjgname">{{fsbzjgname}}</span>
    </div>
    <div>
      <span class="left">部件：</span>
      <span class="right" v-bind="fsbbjname">{{fsbbjname}}</span>
    </div>
    <div>
      <span class="left">原件：</span>
      <span class="right" v-bind="fsbyjname">{{fsbyjname}}</span>
    </div>
    <div>
      <span class="left">问题描述：</span>
      <span class="right" v-bind="fnote">{{fnote}}</span>
    </div>
    <!--<mt-field label="维修负责人："  placeholder="" type="text" v-model="fwxfzr"/>-->
    <!--<mt-field label="联系电话：" placeholder="" type="tel" v-model="fwxfzr_tel"/>-->
    <!--<mt-field label="人数："  placeholder="" type="number" v-model="fwxry"/>-->
    <div>
      <span class="left">维修负责人：</span>
      <mt-field class="right" type="text" v-model="fwxfzr"/>
    </div>
    <div>
      <span class="left">联系电话：</span>
      <mt-field class="right" type="tel" v-model="fwxfzr_tel"/>
    </div>
    <div>
      <span class="left">人数：</span>
      <mt-field class="right" type="number" v-model="fwxry"/>
    </div>
  </div>
</template>

<script>
  export default {
    name: "EditBillPage",
    created() {
      this.getBillDetail();
    },
    methods: {
      getBillDetail() {
        var that = this;
        that.$indicator.open(
          {
            text: '加载中...',
            spinnerType: 'fading-circle'
          }
        );
        var params = new Object();
        var url = global.BASE_URL + '/bill/getBillDetail';
        // params.fid = that.$route.params.fid;
        params.fid = '310'
        this.$http({
          method: 'GET',
          url: url,
          params: params,
        }).then(function (responce) {
          that.$indicator.close();
          var response1 = responce.data;
          var errorCode = response1.errorCode;
          var errorMessage = response1.errorMessage;
          //that.billlist = response1.data;
          that.fgdno = response1.data.fgdno;
          that.fsbname = response1.data.fsbname;
          that.fsbjgname = response1.data.fsbjgname;
          that.fsbzjgname = response1.data.fsbzjgname;
          that.fsbbjname = response1.data.fsbbjname;
          that.fnote = response1.data.fnote;
          that.filename = response1.data.filename;
          that.fsbyjname = response1.data.fsbyjname;
          that.fsbyj = response1.data.fsbyj;
        }).catch(function (error) {
          that.$indicator.close();
          console.log(error)
        })
      }, showToast(msg) {
        // this.$toast(this.$route.params.fid)
        this.$toast(msg)
      }
      , updateBillInfo() {
        var that = this;
        that.$indicator.open(
          {
            text: '加载中...',
            spinnerType: 'fading-circle'
          }
        );
        var params = new Object();
        //var url = 'http://192.168.183.10:8080/bill/updateBillInfo';//实业的ip
        var url = global.BASE_URL + '/bill/updateBillInfo';//煤二期的ip
        // params.fid = that.$route.params.fid;
        params.fid = 310
        params.fwxfzr = that.fwxfzr;
        params.fwxfzr_tel = that.fwxfzr_tel
        params.fwxry = Number(that.fwxry)
        that.$indicator.open()
        this.$http({
          method: 'GET',
          url: url,
          params: params,
        }).then(function (responce) {
          console.log(responce)
          that.$indicator.close();
          var response1 = responce.data;
          var requestcode = responce.status;
          var errorCode = response1.errorCode;
          var errorMessage = response1.errorMessage;
          if (requestcode == 500) {
            that.$messagebox.alert(
              '保存失败！'
            );
          } else {
            that.$messagebox.alert(
              '保存成功！'
            ).then(
              that.goback()
            );
          }

        }).catch(function (error) {
          that.$indicator.close();
          console.log(error)
        })
      },
      goback() {
        this.$router.go(-1)
      }
    }, data() {
      return {
        fid: "",
        fgdno: "",
        fqfdept: "",
        dept_name: "",
        fqfuser: "",
        fryxm: "",
        fsbcode: "",
        fsbname: "",
        fsbjg: "",
        fsbjgname: "",
        fsbzjg: "",
        fsbzjgname: "",
        fsbbj: "",
        fsbbjname: "",
        fuserid: "",
        fnote: "",
        filename: "",
        fsbyjname: "",
        fsbyj: "",
        fwxfzr: "",
        fwxfzr_tel: "",
        fwxry: "",
        msg: ""
      }
    }
  }
</script>

<style scoped>

  .left {
    width: 25%;
    height: auto;
    float: left;
    margin: 5px;
    text-align: right;
    line-height: 30px;
  }

  .right {
    width: 70%;
    height: 30px;
    float: left;
    margin: 5px;
    text-align: left;
    line-height: 30px;
    font-weight: bold;
    font-family: 黑体;
  }


</style>
